#ifndef __LIB_GUI_EVENT_H
#define __LIB_GUI_EVENT_H

#include <stdint.h>
#include <uview_keycode.h>

typedef enum
{
    GUI_PRESSED = 1, // press status
    GUI_RELEASE,     // release status
} gui_keystatus_t;

typedef struct
{
    int code;   // keycode
    int modify; // modify key
} gui_key_info_t;

typedef struct
{
    uint8_t type;           // keyboard event type
    uint8_t status;         // key status
    gui_key_info_t keycode; // key info
} gui_key_event_t;

typedef struct
{
    uint8_t type;
    int x;
    int y;
} gui_mouse_motion_event_t;

typedef enum
{
    GUI_WHEEL_UP = 1,
    GUI_WHEEL_DOWN,
    GUI_WHEEL_LEFT,
    GUI_WHEEL_RIGHT,
} gui_mouse_wheel_type_t;

typedef struct
{
    uint8_t type;
    int wheel;
    int x;
    int y;
} gui_mouse_wheel_event_t;

typedef struct
{
    uint8_t type;
    uint8_t status; // button status
    uint8_t button; // button value
    int x;
    int y;
} gui_mouse_button_event_t;

typedef struct
{
    uint8_t type; // window move type
    int x;
    int y;
} gui_window_move_event_t;

typedef struct
{
    uint8_t type; // window resize type
    int w;        // width
    int h;        // height
} gui_window_resize_event_t;

typedef enum
{
    GUI_NOEVENT = 0, // unused
    GUI_KEY_DOWN,
    GUI_KEY_UP,
    GUI_MOUSE_MOTION,
    GUI_MOUSE_BUTTON_UP,
    GUI_MOUSE_BUTTON_DOWN,
    GUI_MOUSE_WHEEL,
    GUI_TIMER_EVENT,
    GUI_WINRESIZE_EVENT,
    GUI_WINMOVE_EVENT,
    GUI_EVENT_MAX_NUM
} gui_event_type_t;

typedef struct gui_event
{
    gui_event_type_t type;
    gui_window_move_event_t winmove;
    gui_window_resize_event_t winresize;
    gui_key_event_t key;
    gui_mouse_button_event_t button;
    gui_mouse_motion_event_t motion;
    gui_mouse_wheel_event_t wheel;
}gui_event_t;

#endif